import React, { lazy, Suspense } from 'react';
import Loading from '../components/Loading'
import { Route, Switch, Redirect } from 'react-router-dom'
/* 引入需要懒加载的组件 */
const UserIndex = lazy(() => import('../views/user/Index'))
const Welcome = lazy(() => import('../views/index/Welcome'))
const Basicrouter = () => {
    return (
        <Suspense fallback={<Loading />}>
            <Switch>
                <Redirect from='/dashboard' to='/dashboard/welcome' exact />
                <Route path='/dashboard/welcome' component={Welcome}></Route>
                <Route path='/dashboard/user/index' component={UserIndex}></Route>
            </Switch>
        </Suspense>
    );
}

export default Basicrouter;
